package main

type ListNode struct {
	Val  int
	Next *ListNode
}

/**
 *
 * @param head ListNode类
 * @return ListNode类
 */
func deleteDuplicates(head *ListNode) *ListNode {
	// write code here
	node, last := head, head
	for node != nil {
		for node != nil && node.Val == last.Val {
			node = node.Next
		}
		last.Next = node
		last = last.Next
	}
	return head
}
